/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sdd.facades.view;

import com.sdd.facades.business.CommentBusinessFacadeBean;
import com.sdd.facades.factories.CommentFactoryFacadeBean;
import com.sdd.plains.CommentPlain;
import com.sdd.plains.ProductPlain;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;

/**
 *
 * @author Carlos
 */
@Stateless
public class CommentViewFacadeBean implements CommentViewFacade{
    @EJB
    CommentBusinessFacadeBean commentBusinessFacadeBean;
    @EJB
    CommentFactoryFacadeBean commentFactoryFacadeBean;

    @Override
    public CommentPlain getComment(long commentId) {
        return commentFactoryFacadeBean.createCommentPlain(commentBusinessFacadeBean.getComment(commentId));
    }

    @Override
    public CommentPlain addComment(CommentPlain comment) {
        return commentFactoryFacadeBean.createCommentPlain(commentBusinessFacadeBean.addComment(comment));
    }

    @Override
    public List<CommentPlain> getAllCommentsOfAProduct(ProductPlain product) {
        return commentFactoryFacadeBean.createCommentPlain(commentBusinessFacadeBean.getCommentsByProduct(product));
    }

}
